package com.qf.mapper;

import com.qf.entity.MallGoodsSpec;
import com.qf.entity.MallGoodsSpecOptions;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>title: com.qf.mapper</p>
 * <p>Company: wendao</p>
 * author zhuximing
 * date 2021/9/16
 * description:
 */
public interface GoodsSpecMapper {

    public List<MallGoodsSpecOptions> findSpecOptsByPAge(MallGoodsSpecOptions options);


    public int saveSpec(MallGoodsSpec spec);

    @Insert("insert into mall_goods_spec_options (option_name,spec_id)values(#{optionName},#{specId})")
    public int saveOpts(MallGoodsSpecOptions options);

    @Update("update mall_goods_spec_options set option_name=#{optionName} where id = #{id}")
    public int editOpts(MallGoodsSpecOptions options);

    @Select("select * from mall_goods_spec where spec_name=#{specName}")
    public  MallGoodsSpec findSpecByName(String specName);

    @Select("select * from mall_goods_spec_options where option_name=#{optionName}")
    public MallGoodsSpecOptions findOptByName(String optionName);
    @Select("select * from mall_goods_spec")
    public List<MallGoodsSpec> findAll();
    @Update("update  mall_goods_spec set spec_name=#{specName} where id = #{id}")
    int editSpec(MallGoodsSpec spec);
    @Delete("delete from mall_goods_spec_options where id = #{id}")
    int delOpts(MallGoodsSpecOptions option);
    //根据id获取规格信息
    @Select("select * from mall_goods_spec_options where spec_id = #{specId} ")
    public List<MallGoodsSpecOptions> findOptsBySpecId(String specId);
}
